package com.indexingsystem.system.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.github.pagehelper.PageHelper;
import com.indexingsystem.boss.Vo.ApiUrlVo;
import com.indexingsystem.boss.admin.mapper.DhApisMapper;
import com.indexingsystem.boss.common.PagedResult;
import com.indexingsystem.boss.entity.DhApis;
import com.indexingsystem.boss.utils.BeanUtils;
import com.indexingsystem.system.service.DhApisService;
@Service
public class DhApisServiceImpl implements DhApisService {

	@Autowired
	private  DhApisMapper dhApisMapper;
	
	@Override
	public int deleteByPrimaryKey(Integer apiId) {
		// TODO Auto-generated method stub
		return dhApisMapper.deleteByPrimaryKey(apiId);
	}

	@Override
	public int insert(DhApis record) {
		// TODO Auto-generated method stub
		return dhApisMapper.insert(record);
	}

	@Override
	public int insertSelective(DhApis record) {
		// TODO Auto-generated method stub
		return dhApisMapper.insertSelective(record);
	}

	@Override
	public DhApis selectByPrimaryKey(Integer apiId) {
		// TODO Auto-generated method stub
		return dhApisMapper.selectByPrimaryKey(apiId);
	}

	@Override
	public int updateByPrimaryKeySelective(DhApis record) {
		// TODO Auto-generated method stub
		return dhApisMapper.updateByPrimaryKeySelective(record);
	}

	@Override
	public int updateByPrimaryKeyWithBLOBs(DhApis record) {
		// TODO Auto-generated method stub
		return dhApisMapper.updateByPrimaryKeyWithBLOBs(record);
	}

	@Override
	public int updateByPrimaryKey(DhApis record) {
		// TODO Auto-generated method stub
		return dhApisMapper.updateByPrimaryKey(record);
	}

	@Override
	public PagedResult<DhApis> selectDhApisList(ApiUrlVo apiUrlVo) {
		Integer pageNo = apiUrlVo.getPageNumber() == null ? 1 : apiUrlVo.getPageNumber();
		Integer pageSize = apiUrlVo.getPageSize() == null ? 10 : apiUrlVo.getPageSize();
		// startPage是告诉拦截器说我要开始分页了。分页参数是这两个。
		PageHelper.startPage(pageNo, pageSize);
		return BeanUtils.toPagedResult(dhApisMapper.selectDhApisList(apiUrlVo));
	}

	@Override
	public Integer getDhApisListCount(ApiUrlVo apiUrlVo) {
		// TODO Auto-generated method stub
		return dhApisMapper.getDhApisListCount(apiUrlVo);
	}

}
